﻿using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using FileInfo = XUCore.Files.FileInfo;

namespace XUCore.NetCore.Uploads
{
    /// <summary>
    /// 文件上传服务
    /// </summary>
    public interface IFileUploadService
    {
        /// <summary>
        /// 上传分片文件
        /// </summary>
        /// <param name="request">参数</param>
        /// <param name="guid">临时目录名</param>
        /// <param name="chunk">分片文件名</param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task UploadThunckAsync(FileUploadRequest request, string guid, string chunk, CancellationToken cancellationToken);

        /// <summary>
        /// 合并分片
        /// </summary>
        /// <param name="request">参数</param>
        /// <param name="guid">临时目录名</param>
        /// <param name="fileName">文件名</param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<FileInfo> UploadThunckMergeAsync(FileUploadRequest request, string guid, string fileName, CancellationToken cancellationToken);

        /// <summary>
        /// 上传文件。单文件
        /// </summary>
        /// <param name="request">参数</param>
        /// <param name="cancellationToken">取消令牌</param>
        Task<FileInfo> UploadAsync(FileUploadRequest request, CancellationToken cancellationToken = default);

        /// <summary>
        /// 上传文件。多文件
        /// </summary>
        /// <param name="request">参数</param>
        /// <param name="cancellationToken">取消令牌</param>
        Task<IEnumerable<FileInfo>> UploadAsync(MultipleFileUploadRequest request, CancellationToken cancellationToken = default);

        /// <summary>
        /// 上传图片。单张图片
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        Task<ImageFileInfo> UploadImageAsync(ImageUploadRequest request, CancellationToken cancellationToken = default);

        /// <summary>
        /// 上传Base64图片。单张图片
        /// </summary>
        /// <param name="request">参数</param>
        /// <param name="cancellationToken">取消令牌</param>
        Task<ImageFileInfo> UploadImageAsync(Base64ImageUploadRequest request, CancellationToken cancellationToken = default);
    }
}